package StudentMapTable;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class StudentMapTable {
    public static void main(String[] args) {
        Map<String,String>studentMap=new HashMap<>();
        studentMap.put("111111","刘一");
        studentMap.put("222222","陈二");
        studentMap.put("333333","张三");
        studentMap.put("444444","李四");
        studentMap.put("555555","王五");
        studentMap.put("666666","赵六");


        // 通过键找值的方法遍历
        Set<String> k = studentMap.keySet();
        System.out.println("所有学生信息：");
        for(String key:k){
            String v =studentMap.get(key);
            System.out.println(key+" "+v);
        }
//        System.out.println(studentMap.get("555555"));
        System.out.println();
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入学生学号：");
        String s = sc.next();
        System.out.println(studentMap.get(s));

    }
}
